package cn.springbak.publish.web.config;

import cn.springbak.publish.web.interceptor.TimeAccessInterceptor;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class SpringWebConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //将拦截器添加到spring容器
        registry.addInterceptor(new TimeAccessInterceptor())
                //拦截的url
                //.addPathPatterns("/notice/**"); //*代表一层目录
                .addPathPatterns("/notice/doFindNotices",
                        "/notice/doDeleteById");
    }
}
